/*
============================================================================
 Name        : ndsAppUi.cpp
 Author      : Jian
 Version     :
 Copyright   : GPL V2
 Description : Main application UI class (controller)
============================================================================
*/

// INCLUDE FILES
#include <avkon.hrh>
#include <aknnotewrappers.h>
#include <stringloader.h>
#include <nds.rsg>
#include <f32file.h>
#include <s32file.h>

#include "nds.pan"
#include "ndsAppUi.h"
#include "ndsAppView.h"
#include "nds.hrh"

// ============================ MEMBER FUNCTIONS ===============================


// -----------------------------------------------------------------------------
// CndsAppUi::ConstructL()
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CndsAppUi::ConstructL()
    {
    // Initialise app UI with standard value.
    BaseConstructL();

    // Create view object
    iAppView = CndsAppView::NewL( ClientRect() );
    }
// -----------------------------------------------------------------------------
// CndsAppUi::CndsAppUi()
// C++ default constructor can NOT contain any code, that might leave.
// -----------------------------------------------------------------------------
//
CndsAppUi::CndsAppUi()
    {
    // No implementation required
    }

// -----------------------------------------------------------------------------
// CndsAppUi::~CndsAppUi()
// Destructor.
// -----------------------------------------------------------------------------
//
CndsAppUi::~CndsAppUi()
    {
    if ( iAppView )
        {
        delete iAppView;
        iAppView = NULL;
        }

    }

// -----------------------------------------------------------------------------
// CndsAppUi::HandleCommandL()
// Takes care of command handling.
// -----------------------------------------------------------------------------
//
void CndsAppUi::HandleCommandL( TInt aCommand )
    {
    switch( aCommand )
        {
        case EEikCmdExit:
        case EAknSoftkeyExit:
            Exit();
            break;
        case EndsCommand1:
            {
            // Load a string from the resource file and display it
            HBufC* textResource = StringLoader::LoadLC( R_HEWB_COMMAND1_TEXT );
            
            // Show the information Note with
            // textResource loaded with StringLoader.
            CAknInformationNote* informationNote = new ( ELeave ) CAknInformationNote;
            informationNote->ExecuteLD( *textResource );

            // Pop HBuf from CleanUpStack and Destroy it.
            CleanupStack::PopAndDestroy( textResource );
            }
            break;
        default:
            Panic( EndsUi );
            break;
        }
    }
// -----------------------------------------------------------------------------
//  Called by the framework when the application status pane
//  size is changed.  Passes the new client rectangle to the
//  AppView
// -----------------------------------------------------------------------------
//
void CndsAppUi::HandleStatusPaneSizeChange()
{
	iAppView->SetRect( ClientRect() );
	
} 


// End of File
